#include<iostream>
using namespace std;

int main(){
	int x;
	int sum=0;
	cin>>x;
	/*while(x!=0){
		sum+=x%10;
		x/=10;
	}*/
	
	/*do{
		sum+=x%10;
		x/=10;
	}while(x!=0);*/
	
	/*for(;x!=0;){
		sum+=x%10;
		x/=10;
	}*/
	
	while(1){
		sum+=x%10;
		x/=10;
		if(x=0) break;
	}
	
	cout<<sum;
	return 0;
}
